package com.mock.action.organisation.team;

import java.util.ArrayList;
import java.util.List;

import com.mock.action.AbstractAction;
import com.mock.dao.impl.DepartmentImpl;
import com.mock.model.Department;
import com.mock.model.Organisation;

public class GetTeamAddressAction extends AbstractAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2147763237295631847L;
	private Long departmentId;
	private List<String> address = new ArrayList<String>();
	
	public String execute() {
		return SUCCESS;
	}
	
	public String getAddressFromDepartment() {
		System.out.println("De: " + departmentId);
		Department department = new DepartmentImpl().getById(Department.class, departmentId);
		address.add(department.getAddress1());
		address.add(department.getAddress2());
		address.add(department.getAddress3());
		address.add(department.getPostcode());
		address.add(department.getTown());
		address.add(department.getCounty());
		address.add(department.getCountry().getCountryId().toString());
		return SUCCESS;
	}
	
	public String getAddressFromOrganisation() {
		Organisation organisation = new DepartmentImpl().getById(Department.class, departmentId).getDirectorate().getOrganisation();
		address.add(organisation.getAddressLine1());
		address.add(organisation.getAddressLine2());
		address.add(organisation.getAddressLine3());
		address.add(organisation.getPostcode());
		address.add(organisation.getCity());
		address.add(organisation.getCounty());
		address.add(organisation.getCountry().getCountryId().toString());
		return SUCCESS;
	}

	
	/* Getter Setter */
	public Long getDepartmentId() {
		return departmentId;
	}
	
	public void setDepartmentId(Long departmentId) {
		this.departmentId = departmentId;
	}

	public List<String> getAddress() {
		return address;
	}

	public void setAddress(List<String> address) {
		this.address = address;
	}


}
